import Taro, { Component } from '@tarojs/taro'
import { View,Image } from '@tarojs/components'
import '../itemdetail.scss'
const Right = require('../../assets/right.png')
export default class DContent extends Component {
    handleDetail() {
        this.props.handleDetail && this.props.handleDetail(...arguments)
    }
    render() {
        const {
            title,
            info,
            carNo
        } = this.props
        return (
            info.length > 0 && <View className='b_itemdetail__content'>
                <View className='b_itemdetail__content_list'>
                    <View className='b_itemdetail__content_item' >
                        {
                            title && <View className='b_itemdetail__content_title'>{title}</View>
                        }

                        {
                            info && info.map((_item, j) => {
                                return <View className='b_itemdetail__content_info' key={j} onClick={_item.carNo&&this.handleDetail.bind(this,_item)}>
                                    <View className='b_itemdetail__content_info__left'>{_item.label}</View>
                                    {_item.value!='undefined'&&_item.value&&<View className='b_itemdetail__content_info__right'>{_item.value}</View>}
                                    {  _item.icon &&
                                        <Image src={Right} className='b_itemdetail__content_info__img'></Image>
                                    }
                                </View>
                            })
                        }
                    </View>
                </View>
            </View>
        )
    }
}




